# -*- coding:utf-8 -*-
# @Time:2024/4/1921:01
# @Author:miuzg
# @FileName:new test2.py
# @Software:PyCharm
from selenium import webdriver
import time

url = 'https://www.baidu.com/'

driver = webdriver.Edge()

driver.get(url)

# execute_script 会自动识别里面的字符串，以js代码指令执行

js = 'open("https://www.mi.com/shop")'
driver.execute_script(js)
driver.execute_script('open("http://www.cxy521.com/")')
time.sleep(3)

# 切换窗口
driver.switch_to.window(driver.window_handles[1])

input('输入回车键关闭窗口')